<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>经典美文</title>
	<%@ include file="top_new.jsp"%> 
	<link rel="stylesheet" type="text/css" href="/css/meiwen_style.css">
</head>
<body>
	<div class="content">
	<input type="hidden" name="fid" id="fid" value="${grid.fid}">
		<div class="contentL">
			<div class="details">
				<h1 class="detailsTit">${grid.ftitle}</h1><!-- 文章标题 -->
				<div class="detailsBar">
					<span>${grid.fdescribe}<span class="detailsLine">|</span>${grid.ffrom}<span class="detailsLine">|</span><span class="detailsTime">${grid.fdate}</span><!-- 时间 -->
						<c:if test="${grid.fstatus == 0}">
							<span>
								<a  style="float: right;padding-bottom: 2px;" class='button border-red' href='javascript:void(0)'  onclick="eidt()"><i class='layui-icon'>&#xe642;</i> </a>
							</span>
							<span >
								<a  style="float: right;padding-bottom: 2px;" class='button border-red' href='javascript:void(0)'  onclick="pass()"><i class='layui-icon'>&#x1005;</i> </a>
							</span>
						</c:if>
						<c:if test="${grid.fstatus == 1}">
							<span>
								<a  style="float: right;padding-bottom: 2px;" class='button border-red' href='javascript:void(0)'  onclick="cancle()"><i class='layui-icon'>&#x1006;</i> </a>
							</span>
						</c:if>
					</span>
				</div>
				<!--
				<div class="detailsPic">
				<center>
					<img src="./详情页_files/17.jpg" alt="">
				</center>
				</div> 文章三张图片 -->

				<div class="detailsContent">
					${grid.fhtml}
				</div><!-- 文章内容 -->
			</div><!-- details新闻详情 -->
		</div><!-- contentL内容左侧 -->
	</div><!-- content中间内容区 -->
</body>
</html>
<script type="text/javascript">
	function eidt(id){
		var fid = $("#fid").val()
		window.location.href='<%=basePath%>grid/toNewGrid?fid='+fid;
	}
	function pass(id){
		var fid = $("#fid").val()
		var index = layer.load(2, {time: 10000}); //又换了种风格，并且设定最长等待10秒 
		$.post(basePath+'grid/saveGrid',
		    {
				fstatus:1,
				fid:fid
		    },
		    function(ret){
		    	if (ret.isOk) {
		    		layer.msg('文章已审核,查看请到审核列表', {icon: 1});
	    			setTimeout(window.close(),1000); 
		    	}else{
		    		layer.msg(ret.msg, {shift: 6});
		    	}
		    	//关闭
				layer.close(index); 
		    }); 
	}
	function cancle(){
		var id = $("#fid").val();
		var index = layer.load(2, {time: 10000}); //又换了种风格，并且设定最长等待10秒 
		if(confirm("确定需要取消文章审核?")){
			$.post("<%=basePath%>grid/gridCancle",
				    {
						fid:id
				    },
				    function(ret){
				    	if (ret.isOk) {
				    		layer.msg('文章取消审核成功', {icon: 1});
				    		setTimeout(window.close(),1000); 
				    	}else{
				    		layer.msg(ret.msg, {shift: 6});
				    	}
				    	//关闭
						layer.close(index); 
				    }); 
		}
	}
</script>